package Math类;
/**
 * 获取随机字符
 * @author Administrator
 *
 */
public class RandomCharacter {

	/**
	 * generate   a random character between ch1 and ch2
	 * @param ch1
	 * @param ch2
	 * @return
	 */
	public static char getRandomCharacter(char ch1,char ch2){
		
		return (char)(ch1 + Math.random() * (ch2 - ch1 + 1));
	}
	/*
	 * generate a random lowerCase letter 
	 */
	public static char getRandomLowerCaseLetter(){
		return getRandomCharacter('a', 'z');
	}
	
	/**
	 * generate a random UpperCase letter 
	 * 随机得到大写A--Z之间的大写字母
	 * @return
	 */
	public static char getRandomUpperCaseLetter(){
		return getRandomCharacter('A', 'Z');
	}
	/*
	 * generate a random number and  digit character
	 */
	public static char getRandomDigitCharacter(){
		return getRandomCharacter('0', '9');
	}
	
	/*
	 * generate a random character 
	 */
	public static char getRandomCharacter(){
		
		return getRandomCharacter('\u0000','\uFFFF');
	}
}
